{% extends "departments/base.html" %}
<!-- stylesheet -->
{% load static %}
{% block title %}
  社团荟萃
{% endblock %}
{% block departments-external %}
{% endblock %}]

{% block logo %}
<a href="{% url 'overview:index' %}" title="极客协会"><img src="https://pic.downk.cc/item/5ebf6257c2a9a83be59950c4.png" width="120" height="120" border="0" alt="极客协会" title="极客协会"></a><!--#endeditable-->
{% endblock %}
{% block department %}
<div class="bottom-header blog">
<div class="container">
<div class="row">
<div class="col-sm-12">
<h2>社团荟萃</h2></div></div></div></div>
{% endblock %}
{% block introduction %}
 <div class="row">
     <ul class="nav nav-pills nav-justified">
	<li><a href="{% url 'departments:associations' 1 %}">武进校区</a></li>
	<li><a href="{% url 'departments:associations' 2 %}">西太湖校区</a></li>
	<li><a href="{% url 'departments:associations' 3 %}">白云校区</a></li>
</ul>
      <div class="row container" style="height:50px;margin-left:10px;margin-top:0px;display:inline-block">
        <div class="col-auto mr-auto col-md-offset-8">
            <div id="sidebar" style="height:50px;margin-left:5px;margin-top:10px;display:inline-block">
            <div class="widget widget_search" style="height:50px;margin-left:5px;margin-top:10px;display:inline-block">
<div class="widget-title" >
    <h3>本站搜索</h3>
            <form role="search" method="get" class="search-form" action="#"><div class="search-form-box">
  <input type="submit" id="searchsubmit" value="">
  <input type="search" id="s" placeholder="Search..." value="" name="kw" title="搜索">
</div></form>
        </div>
    </div>
        </div>
          </div>
      </div>

{% if not campuses %}
    <p>目前暂无信息，欢迎大家录入！</p>
{% endif %}
<div class="container" style="margin-left:30px;margin-top:50px">
<div class="row">
<div class="col-sm-8"><section id="blog"><article class="blog-post">
{% for campus in campuses %}
<div class="blog-post-entry">
    {% if not associations %}
    <article class="blog-post catalogue">
<a title="暂无" class="blog-post-title" href="#"> 暂无 </a>
<div class="blog-post-entry">
<p>暂无</p>
</div><a title="暂无" class="blog-post-button" href="#">read more</a>
<hr>
</article>
    {% endif %}
    {% for association in associations %}
    {% if association.campus.name == campus.name %}
    <article class="blog-post catalogue" style="margin:20px auto;padding: 10px;box-shadow: 0 0 10px #e3e3e3;">
        <div class="row" style="margin-bottom: 20px;">
          <div class="col-sm-4 col-sm-offset-4" style="text-align: left;">
            <img src="{{association.image.url}}" class="img-circle" alt="常州大学" style="width: 100px; height: 100px;"/>
          </div>
        </div>
<a title="{{association.name}}" class="blog-post-title" href="{% url 'departments:association_info' association.id %}"> {{association.name}} </a>
<div class="blog-post-meta">
    <span class="post-meta-time"><i class="fa fa-calendar"></i>{{association.created_time}} </span>
    <span class="post-meta-categories"><i class="fa fa-folder-o"></i> {{association.campus}} </span>
</div>
<div class="blog-post-entry">
<p>{{association.desc|slice:100}}...</p>
</div><a title="{{association.name}}" class="blog-post-button" href="{% url 'departments:association_info' association.id %}">read more</a>
<hr>
</article>
    {% endif %}
    {% endfor %}
    </div>
    {% endfor %}
    </article>
</section></div>
<!-- 搜索样式 -->

</div>
</div>

{% if associations %}
<div style="text-align:center">
 <div class="pagination row">
        <div class="m-auto">
        <span class="step-links">
            <!-- 如果不是第一页，则显示上翻按钮 -->
            {% if associations.has_previous %}
                <a href="?page=1&kw={{ kw }}" class="btn btn-success">
                    &laquo; 1
                </a>
                <span>...</span>
                <a href="?page={{ associations.previous_page_number }}&kw={{ kw }}"
                   class="btn btn-secondary"
                >
                    {{ associations.previous_page_number }}
                </a>
            {% endif %}

            <!-- 当前页面 -->
            <span class="current btn btn-danger btn-lg">
                {{ associations.number }}
            </span>

            <!-- 如果不是最末页，则显示下翻按钮 -->
            {% if associations.has_next %}
                <a href="?page={{ associations.next_page_number }}&kw={{ kw }}"
                   class="btn btn-secondary"
                >
                    {{ associations.next_page_number }}
                </a>
                <span>...</span>
                <a href="?page={{ associations.paginator.num_pages }}&kw={{ kw }}"
                   class="btn btn-success"
                >
                    {{ associations.paginator.num_pages }} &raquo;
                </a>
            {% endif %}
        </span>
        </div>
    </div>
</div>
{% endif %}
<!--
 <div class="navigation">
  <ul>
   {% for pg in associations.paginator.page_range %}
    {% if associations.number == pg %}
     <li class="active"><a href="?page={{ associations.paginator.num_pages }}&kw={{ kw }}" rel="external nofollow" rel="external nofollow" >{{ pg }}</a></li>
    {% else %}
     <li><a href="?page={{ pg }}&kw={{kw}}" rel="external nofollow" rel="external nofollow" >{{ pg }}</a></li>
    {% endif %}
   {% endfor %}

   {% if contacts.has_next %}
    <li><a href="?page={{ associations.next_page_number }}&kw={{kw}}" rel="external nofollow" >下一页</a></li>
   {% endif %}
  </ul>
 </div>
 -->
 </div>
{% endblock %}